import { defineStore } from 'pinia';

const menu = defineStore({
  // 这里的id必须为唯一ID
  id: 'menu',
  state: () => {
    return {
      menuList: [],
      name: '123'
    };
  },
  // 等同于vuex的getter
  getters: {
    getMenuList: (state) => state.menuList
  },
  // pinia 放弃了 mutations 只使用 actions
  actions: {
    // actions可以用async做成异步形式
    setMenuList(arr: any) {
      console.log(arr, '22222222222')
      
      this.menuList = arr;
    },
  },
});

export default menu;
